-
-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: avoid extra rerender #2558
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
We should probably add another test to ensure that If anyone is interested, contributions are welcome. It requires decent knowledge about React rendering. Another point is that this optimization should be handled with React binding. There's nothing wrong in store implementation. |
Preview in LiveCodesLatest commit: 515f416
See documentations for usage instructions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add another test to ensure that rerender() in useEffect is required, before tackling this.
Please create a test for rerender()
first before tackling this. Otherwise, you don't know why we need it. I think it's reasonable to create a separate PR.
Another point is that this optimization should be handled with React binding. There's nothing wrong in store implementation.
Please do not modify store implementation.
If I have uderstood correctly, |
Yeah, let's leave it for now. Here's some comments for the future.
If we were to optimize it in Jotai v2, it must be within the hook. |
Closing this for now. If anyone is interested, feel free to develop a third-party library (that provides its own |
Summary
useAtomValue called rerender inside useEffect, which led to an additional render, and this PR optimized that performance issue add a optimization test.
Check List
pnpm run prettier
for formatting code and docs